import request from '@/utils/request';

export function saveFangan(data) {
  return request({
    url: '/txs/fangan',
    method: 'put',
    data,
  });
}

export function getFanganByCid(cid) {
  return request({
    url: '/txs/fangan/' + cid,
    method: 'get',
  });
}

// 查询顾客系统方案
export function getBaseClerkScheme(id) {
  return request({
    url: '/txs/fangan/scheme/' + id,
    method: 'get',
  });
}

export function sumMoneyByKeepers(data) {
  return request({
    url: '/txs/money/sum/keepers',
    method: 'put',
    data,
  });
}

export function getScoreByUidAndSdate(uid, sdate) {
  return request({
    url: '/txs/score/' + uid,
    method: 'get',
    params: { sdate },
  });
}

export function getList(pageNumber, pageSize) {
  return request({
    url: '/txs/score',
    method: 'get',
    params: { pageNumber, pageSize },
  });
}

export function addAdminScore(data) {
  return request({
    url: '/txs/score',
    method: 'post',
    data,
  });
}

export function setScore(data) {
  return request({
    url: '/txs/score',
    method: 'put',
    data,
  });
}

export function activity(sid) {
  return request({
    url: '/txs/clerk/activity/' + sid,
    method: 'get',
  });
}

export function countGradeBySid(sid) {
  return request({
    url: '/txs/clerk/grade/' + sid,
    method: 'get',
  });
}

export function countRichBySid(sid) {
  return request({
    url: '/txs/clerk/rich/' + sid,
    method: 'get',
  });
}

export function countDengjiBySid(sid) {
  return request({
    url: '/txs/clerk/dengji/' + sid,
    method: 'get',
  });
}

export function countTrustBySid(sid) {
  return request({
    url: '/txs/clerk/stattrust/' + sid,
    method: 'get',
  });
}

export function getRecordsByCid(cid) {
  return request({
    url: '/txs/record/' + cid,
    method: 'get',
  });
}

export function countTodayBySid(sid) {
  return request({
    url: '/txs/record/counttoday/' + sid,
    method: 'get',
  });
}

export function countMoneyTodayBySid(sid) {
  return request({
    url: '/txs/money/counttoday/' + sid,
    method: 'get',
  });
}

export function countMoneyMonthBySid(sid) {
  return request({
    url: '/txs/money/countmonth/' + sid,
    method: 'get',
  });
}

export function countNobleTodayBySid(sid) {
  return request({
    url: '/txs/record/countnoble/' + sid,
    method: 'get',
  });
}

export function countNobleAllBySid(sid) {
  return request({
    url: '/txs/clerk/countnoble/' + sid,
    method: 'get',
  });
}

export function countTrustTodayBySid(sid) {
  return request({
    url: '/txs/record/counttrust/' + sid,
    method: 'get',
  });
}

export function countTrustAllBySid(sid) {
  return request({
    url: '/txs/clerk/counttrust/' + sid,
    method: 'get',
  });
}

export function countAllBySid(sid) {
  return request({
    url: '/txs/record/countall/' + sid,
    method: 'get',
  });
}

export function countTodayClerkBySid(sid) {
  return request({
    url: '/txs/clerk/counttoday/' + sid,
    method: 'get',
  });
}

export function countAllClerkBySid(sid) {
  return request({
    url: '/txs/clerk/countall/' + sid,
    method: 'get',
  });
}

export function addRecord(data) {
  return request({
    url: '/txs/record',
    method: 'post',
    data,
  });
}

export function addRecordAudio(data) {
  return request({
    url: '/txs/record/audio',
    method: 'post',
    data,
  });
}

export function getDealsByCid(cid) {
  return request({
    url: '/txs/deal/' + cid,
    method: 'get',
  });
}

export function getCostBySid(sid) {
  return request({
    url: '/txs/cost/' + sid,
    method: 'get',
  });
}

export function getSpendBySid(sid, status) {
  return request({
    url: '/txs/cost/spend/' + sid,
    method: 'get',
    params: { status },
  });
}

export function putSpendById(id, data) {
  return request({
    url: '/txs/cost/spend/' + id,
    method: 'put',
    data,
  });
}

export function addSpend(data) {
  return request({
    url: '/txs/cost/spend',
    method: 'post',
    data,
  });
}

export function getIncomeBySid(sid) {
  return request({
    url: '/txs/money/income/' + sid,
    method: 'get',
  });
}

export function addIncome(data) {
  return request({
    url: '/txs/money/income',
    method: 'post',
    data,
  });
}

export function addDeal(data) {
  return request({
    url: '/txs/money/deal',
    method: 'post',
    data,
  });
}

export function getPlanByMonth(sid, cdate) {
  return request({
    url: '/txs/plan/month',
    method: 'get',
    params: { sid, cdate },
  });
}
/**
 * @deprecated 记录成交时(addDeal), 后台自动更新顾客的消费等级
 * @param {number} id
 * @param {Object} data
 * @return {Promise}
 */
export function putConsumerGrade(id, data) {
  return request({
    url: '/txs/clerk/consume/' + id,
    method: 'put',
    data,
  });
}

export function putSalonByMiddle(data) {
  return request({
    url: '/txs/salon/middle',
    method: 'put',
    data,
  });
}

export function getCallbackByKid(kid) {
  return request({
    url: '/txs/callback/' + kid,
    method: 'get',
  });
}

export function countRestQuota(sid) {
  return request({
    url: '/txs/clerk/quota/' + sid,
    method: 'get',
  });
}

export function updateCallback(data) {
  return request({
    url: '/txs/callback',
    method: 'put',
    data,
  });
}

export function addCallback(data) {
  return request({
    url: '/txs/callback',
    method: 'post',
    data,
  });
}

export function getDealsBykid(kid) {
  return request({
    url: '/txs/money/deal/' + kid,
    method: 'get',
  });
}

export function getFaceTagsByCid(cid) {
  return request({
    url: '/txs/face/' + cid,
    method: 'get',
  });
}

export function addFaceTag(data) {
  return request({
    url: '/txs/face',
    method: 'post',
    data,
  });
}

export function addFaceTags(data) {
  return request({
    url: '/txs/face/list',
    method: 'post',
    data,
  });
}

export function addFacePic(data) {
  return request({
    url: '/txs/face/pic',
    method: 'post',
    data,
  });
}
